/*
 Navicat Premium Data Transfer

 Source Server         : 本地
 Source Server Type    : MySQL
 Source Server Version : 50734
 Source Host           : localhost:3306
 Source Schema         : ddd-example

 Target Server Type    : MySQL
 Target Server Version : 50734
 File Encoding         : 65001

 Date: 19/09/2021 12:05:19
*/



-- 建库
CREATE DATABASE IF NOT EXISTS `iam-service` default charset utf8mb4 COLLATE utf8mb4_unicode_ci;

use iam-service;
-- 切换数据库


SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单名称',
  `code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单编码',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色描述',
  `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '菜单链接',
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '图标',
  `type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'menu' COMMENT '菜单类型',
  `parent_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '父元素id，0为根',
  `sort` int(11) DEFAULT '0',
  `system_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '唯一id',
  `created_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `updated_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `deleted_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '删除人',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_menu` VALUES ('删除角色', 'REMOVE_ROLE', NULL, NULL, NULL, 'button', '2d032106abf6fb94c323', 0, 'fb9971dc7020af64da32', '0ad852ea537ce63c2a94', 'admin', 'anno', NULL, '2021-09-17 17:36:33', '2021-09-17 17:36:46', NULL);
INSERT INTO `sys_menu` VALUES ('编辑菜单', 'UPDATE_MENU', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', '0ba58feb6f44311da4e8', 'admin', NULL, NULL, '2021-09-17 16:26:59', '2021-09-17 16:26:59', NULL);
INSERT INTO `sys_menu` VALUES ('角色管理', 'ROLE_MANAGE', NULL, '/role', 'audit-outlined', 'menu', '0', 1, 'fb9971dc7020af64da32', '2d032106abf6fb94c323', 'admin', NULL, NULL, '2021-09-16 15:51:58', '2021-09-16 15:51:58', NULL);
INSERT INTO `sys_menu` VALUES ('更新用户', 'UPDATED_USER', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', '368831f0a3fc90f6a6b0', 'admin', NULL, NULL, '2021-09-16 16:44:42', '2021-09-16 16:44:42', NULL);
INSERT INTO `sys_menu` VALUES ('用户管理', 'USER_MANAGE', NULL, '/user', 'user-outlined', 'menu', '0', 0, 'fb9971dc7020af64da32', '43c694e6ddd98f450d72', 'admin', NULL, NULL, '2021-09-16 15:51:16', '2021-09-16 15:51:16', NULL);
INSERT INTO `sys_menu` VALUES ('删除菜单', 'REMOVE_MENU', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', '4a5db879973101e6a0fc', 'admin', NULL, NULL, '2021-09-17 16:27:32', '2021-09-17 16:27:32', NULL);
INSERT INTO `sys_menu` VALUES ('创建角色', 'CREATE_ROLE', NULL, NULL, NULL, 'button', '2d032106abf6fb94c323', 0, 'fb9971dc7020af64da32', '4a7f07b19bfbdbff4787', 'admin', NULL, NULL, '2021-09-17 17:34:39', '2021-09-17 17:34:39', NULL);
INSERT INTO `sys_menu` VALUES ('设为超管', 'SET_SUPER_ADMIN', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', '55a4990962ea7ffded53', 'admin', 'anno', NULL, '2021-09-17 14:18:46', '2021-09-17 14:18:54', NULL);
INSERT INTO `sys_menu` VALUES ('启用用户', 'ENABLE_USER', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', '5d81f6cc7b5d7e152990', 'admin', NULL, NULL, '2021-09-17 14:17:24', '2021-09-17 14:17:24', NULL);
INSERT INTO `sys_menu` VALUES ('删除用户', 'DELETE_USER', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', '7b352abc40f678e4a823', 'admin', NULL, NULL, '2021-09-17 14:16:32', '2021-09-17 14:16:32', NULL);
INSERT INTO `sys_menu` VALUES ('角色授权', 'ROLE_AUTHORIZATION', NULL, NULL, NULL, 'button', '2d032106abf6fb94c323', 0, 'fb9971dc7020af64da32', '872ca1d4585e72afec5d', 'admin', 'anno', NULL, '2021-09-17 17:37:07', '2021-09-17 17:37:13', NULL);
INSERT INTO `sys_menu` VALUES ('新增菜单', 'CREATE_MENU', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', '9f6be0bcbd0e7b300ed0', 'admin', NULL, NULL, '2021-09-17 16:26:17', '2021-09-17 16:26:17', NULL);
INSERT INTO `sys_menu` VALUES ('删除系统', 'REMOVE_SYSTEM', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', 'a24bb10d1c2e47fe2e89', 'admin', NULL, NULL, '2021-09-17 16:25:38', '2021-09-17 16:25:38', NULL);
INSERT INTO `sys_menu` VALUES ('禁用用户', 'DISABLE_USER', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', 'a5a66369dc792821e7d7', 'admin', 'anno', NULL, '2021-09-17 14:16:49', '2021-09-17 14:16:55', NULL);
INSERT INTO `sys_menu` VALUES ('权限管理', 'AUTH_MANAGE', NULL, '/auth', 'lock-outlined', 'menu', '0', 2, 'fb9971dc7020af64da32', 'ab008b03cdeeb5628a13', 'admin', NULL, NULL, '2021-09-16 15:52:28', '2021-09-16 15:52:28', NULL);
INSERT INTO `sys_menu` VALUES ('回收超管', 'RECYCLE_SUPER_ADMIN', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', 'b0218203df05d3235d11', 'admin', NULL, NULL, '2021-09-17 14:19:21', '2021-09-17 14:19:21', NULL);
INSERT INTO `sys_menu` VALUES ('重置密码', 'RESET_PASSWORD', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', 'b357dcba421819623ef0', 'admin', NULL, NULL, '2021-09-17 14:18:14', '2021-09-17 14:18:14', NULL);
INSERT INTO `sys_menu` VALUES ('编辑角色', 'UPDATE_ROLE', NULL, NULL, NULL, 'button', '2d032106abf6fb94c323', 0, 'fb9971dc7020af64da32', 'b60df2dace6419c51952', 'admin', NULL, NULL, '2021-09-17 17:35:24', '2021-09-17 17:35:24', NULL);
INSERT INTO `sys_menu` VALUES ('创建用户', 'CREATE_USER', NULL, NULL, NULL, 'button', '43c694e6ddd98f450d72', 0, 'fb9971dc7020af64da32', 'beea8a74fedbd9ba100f', 'admin', NULL, NULL, '2021-09-16 16:42:47', '2021-09-16 16:42:47', NULL);
INSERT INTO `sys_menu` VALUES ('新建系统', 'CREATE_SYSTEM', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', 'e6981045d98043056832', 'admin', NULL, NULL, '2021-09-17 16:24:32', '2021-09-17 16:24:32', NULL);
INSERT INTO `sys_menu` VALUES ('编辑系统', 'UPDATE_SYSTEM', NULL, NULL, NULL, 'button', 'ab008b03cdeeb5628a13', 0, 'fb9971dc7020af64da32', 'f0306d78b258ef0c355a', 'admin', NULL, NULL, '2021-09-17 16:24:56', '2021-09-17 16:24:56', NULL);
COMMIT;

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色名称',
  `code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色编码',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色描述',
  `id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '唯一id',
  `created_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `updated_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `deleted_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '删除人',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_menu`;
CREATE TABLE `sys_role_menu` (
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `menu_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `role_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`menu_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Table structure for sys_system
-- ----------------------------
DROP TABLE IF EXISTS `sys_system`;
CREATE TABLE `sys_system` (
  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '系统名称',
  `code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '系统编码',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '系统描述',
  `url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '系统连接',
  `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '系统图标',
  `id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '唯一id',
  `created_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `updated_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `deleted_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '删除人',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of sys_system
-- ----------------------------
BEGIN;
INSERT INTO `sys_system` VALUES ('权限管理系统', 'iam', NULL, NULL, NULL, 'fb9971dc7020af64da32', 'admin', NULL, NULL, '2021-09-16 15:23:53', '2021-09-16 15:23:53', NULL);
COMMIT;

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_super_admin` tinyint(1) DEFAULT '0',
  `salt` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` tinyint(10) DEFAULT '1',
  `last_login_at` datetime DEFAULT NULL,
  `last_login_ip` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '唯一id',
  `created_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
  `updated_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
  `deleted_by` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '删除人',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES ('admin', '$2b$10$Oqd2gLkdI4sAVRUpBpp4U.D5LxgDzB/c/xuYiQoYddj3R1vF2lE1G', 1, '$2b$10$Oqd2gLkdI4sAVRUpBpp4U.', NULL, NULL, 1, '2021-09-19 11:46:27', '::ffff:127.0.0.1', '606d1fbb059195c6746b', 'anno', 'admin', NULL, '2021-09-16 15:10:44', '2021-09-19 11:46:27', NULL);
COMMIT;

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `role_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`role_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SET FOREIGN_KEY_CHECKS = 1;
